﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Globalization;

namespace Genetic
{
    public class CustomCommands
    {
        public static RoutedCommand NewMod = new RoutedCommand();
        public static RoutedCommand NewFile = new RoutedCommand();
        public static RoutedCommand OpenMod = new RoutedCommand();
        public static RoutedCommand OpenFile = new RoutedCommand();
        public static RoutedCommand OpenRecentFileShortCut = new RoutedCommand();
        public static RoutedCommand OpenRecentFile = new RoutedCommand();
        public static RoutedCommand Close = new RoutedCommand();
        public static RoutedCommand CloseMod = new RoutedCommand();
        public static RoutedCommand Save = new RoutedCommand();
        public static RoutedCommand SaveAs = new RoutedCommand();
        public static RoutedCommand SaveAll = new RoutedCommand();
        public static RoutedCommand Exit = new RoutedCommand();
        public static RoutedCommand Undo = new RoutedCommand();
        public static RoutedCommand Redo = new RoutedCommand();
        public static RoutedCommand Cut = new RoutedCommand();
        public static RoutedCommand Copy = new RoutedCommand();
        public static RoutedCommand Paste = new RoutedCommand();
        public static RoutedCommand AddMenu = new RoutedCommand();
        public static RoutedCommand Add = new RoutedCommand();
        public static RoutedCommand Delete = new RoutedCommand();
        public static RoutedCommand ChangeVisibility = new RoutedCommand();
        public static RoutedCommand SelectAll = new RoutedCommand();
        public static RoutedCommand PropertiesWindow = new RoutedCommand();
        public static RoutedCommand SystemEditorWindow = new RoutedCommand();
        public static RoutedCommand CloseAllDocuments = new RoutedCommand();
        public static RoutedCommand Settings = new RoutedCommand();
        public static RoutedCommand ReportIssue = new RoutedCommand();
        public static RoutedCommand VisitForum = new RoutedCommand();
        public static RoutedCommand CheckUpdate = new RoutedCommand();
        public static RoutedCommand About = new RoutedCommand();

        static CustomCommands()
        {
            NewMod = GetCommand("NewMod", new KeyGesture(Key.N, ModifierKeys.Control));
            NewFile = GetCommand("NewFile", new KeyGesture(Key.N, (ModifierKeys.Control | ModifierKeys.Shift)));
            OpenMod = GetCommand("OpenMod", new KeyGesture(Key.O, ModifierKeys.Control));
            OpenFile = GetCommand("OpenFile", new KeyGesture(Key.O, (ModifierKeys.Control | ModifierKeys.Shift)));
            OpenRecentFileShortCut = GetCommand("OpenRecentFileShortCut", new KeyGesture(Key.O, (ModifierKeys.Control | ModifierKeys.Alt | ModifierKeys.Shift)));
            Close = GetCommand("Close", new KeyGesture(Key.W, ModifierKeys.Control));
            Save = GetCommand("Save", new KeyGesture(Key.S, ModifierKeys.Control));
            SaveAs = GetCommand("SaveAs", new KeyGesture(Key.S, (ModifierKeys.Control | ModifierKeys.Alt)));
            SaveAll = GetCommand("SaveAll", new KeyGesture(Key.S, (ModifierKeys.Control | ModifierKeys.Alt | ModifierKeys.Shift)));
            Exit = GetCommand("Exit", new KeyGesture(Key.F4, ModifierKeys.Alt));

            Undo = GetCommand("Undo", new KeyGesture(Key.Z, ModifierKeys.Control));
            Redo = GetCommand("Redo", new InputGestureCollection { new KeyGesture(Key.Y, ModifierKeys.Control), new KeyGesture(Key.Z, (ModifierKeys.Control | ModifierKeys.Shift)) });
            Cut = GetCommand("Cut", new KeyGesture(Key.X, ModifierKeys.Control));
            Copy = GetCommand("Copy", new KeyGesture(Key.C, ModifierKeys.Control));
            Paste = GetCommand("Paste", new KeyGesture(Key.V, ModifierKeys.Control));
            Add = GetCommand("Add", new KeyGesture(Key.E, ModifierKeys.Control));
            Delete = GetCommand("Delete", new KeyGesture(Key.Delete));
            ChangeVisibility = GetCommand("ChangeVisibility", new KeyGesture(Key.H, ModifierKeys.Control));
            SelectAll = GetCommand("SelectAll", new KeyGesture(Key.A, ModifierKeys.Control));

            PropertiesWindow = GetCommand("PropertiesWindow", new KeyGesture(Key.F4));
            SystemEditorWindow = GetCommand("SystemEditorWindow", new KeyGesture(Key.F3));

            CloseAllDocuments = GetCommand("CloseAllDocuments", new KeyGesture(Key.W, (ModifierKeys.Control | ModifierKeys.Shift)));
            VisitForum = GetCommand("VisitForum", new KeyGesture(Key.F1));
        }

        static RoutedCommand GetCommand(string name, KeyGesture key)
        {
            return GetCommand(name, new InputGestureCollection { key });
        }

        static RoutedCommand GetCommand(string name, InputGestureCollection keys)
        {
            return new RoutedCommand(name, typeof(CustomCommands), keys);
        }
    }
}
